<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
	String port = request.getServerPort() == 80 ? "" : ":".concat(request.getServerPort()+"");
	String path = request.getScheme().concat("://").concat(request.getServerName()).concat(port).concat(request.getContextPath());
	request.setAttribute("path", path);
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<title>我的评论 - 个人中心 - IT答案网</title>
<meta name="keywords" content="我的评论" />
<meta name="description" content="我的评论" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${path }/view/portal/css/all.css" rel="stylesheet">
<link href="${path }/view/portal/css/prettify.css" rel="stylesheet">
<script src="${path }/view/portal/js/all.js"></script>
</head>
<body>
  <jsp:include page="head.jsp"></jsp:include>
  <div class="container container1000">
	<div class="content">
		
		<form class="breadcrumb form-search" style="margin-bottom:10px" action="#">
			<div>
				<label></label>
				<input type="text" maxlength="50" class="input-medium" placeholder="内容ID"  name="postId" value="${page.conditions.postId }">
				&nbsp;
				<input type="submit" value="查询" class="btn">
			</div>
		</form>
		
		<shiro:hasAnyRoles name="admin,publisher">
		<input type="button" class="btn btn-small btn-primary" value="审核通过" onclick="doBatch('ids', '${ctx}/user/comment/audit?audit=1&ids=');"/>
		<input type="button" class="btn btn-small btn-primary" value="审核拒绝" onclick="doBatch('ids', '${ctx}/user/comment/audit?audit=2&ids=');"/>
		<br/><br/>
	    </shiro:hasAnyRoles>
	    
		<table class="table table-bordered table-striped table-condensed">
			<thead>
				<tr>
				    <shiro:hasRole name="admin">
					<th class="span1">
						<input type="checkbox" id="selectall" name="selectall" 
							onclick="selectAll('selectall', 'ids')">
					</th>
					</shiro:hasRole>
					<th class="span1">内容ID</th>
					<th class="span1">评论者</th>
					<th class="span1">时间</th>
					<th class="span1">楼层</th>
					<th class="span4">内容</th>
					<th class="span1">审核</th>
					<th class="span1">审核人</th>
					<th class="span2">拒绝原因</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${page.datas }" var="data">
					<tr>
						<shiro:hasRole name="admin"><td><input type="checkbox" name="ids" value="${data.id }" <c:if test="${data.audit != 0 }">disabled="disabled" readOnly="true"</c:if>/></td></shiro:hasRole>
						<td>
							<shiro:hasAnyRoles name="admin,publisher">
							  <c:set var="postType" value="${data.postId/100000000+1 }"></c:set>
							  <fmt:parseNumber var="num" integerOnly="true" value="${postType }" />
							  <a href="${ctx }/post-${num }-${data.postId }.html" title="${data.postId }">
							</shiro:hasAnyRoles>
								${data.postId }
							<shiro:hasAnyRoles name="admin,publisher"></a></shiro:hasAnyRoles>
						</td>
						<td>
							<shiro:hasAnyRoles name="admin,publisher"><a href="${ctx }/user/user/edit?id=${data.userId}" target="_blank"></shiro:hasAnyRoles>${data.name }<shiro:hasAnyRoles name="admin,publisher"></a></shiro:hasAnyRoles>
						</td>
						<td>
						   <fmt:formatDate value="${data.updateDate }" pattern="yyyy/MM/dd HH:mm:ss"/>
						</td>
						<td>
						   ${data.floor }
						</td>
						<td>
						   ${data.comment }
						</td>
						<td>
						   <c:if test="${data.audit == 0 }">待审</c:if><c:if test="${data.audit == 1 }">通过</c:if><c:if test="${data.audit == 2 }">拒绝</c:if>
						</td>
						<td>
						   ${data.auditName }
						</td>
						<td>
						   <shiro:lacksPermission name="comment:audit">${data.auditContent }</shiro:lacksPermission>
						   <shiro:hasPermission name="comment:audit">
						      <c:if test="${data.audit == 2 }">
						      <textarea rows="1" cols="2" name="audit_content_${data.id }">${data.auditContent }</textarea>
						      <input type="button" class="btn btn-small btn-primary" value="保存" onclick="javascript:editAuditContent(${data.id})"/>
						      </c:if>
						      <c:if test="${data.audit == 1 }">
						                              无
						      </c:if>
						   </shiro:hasPermission>
						   <sh
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	
	</div>
	<c:set var="params" value="postId=${page.conditions.postId }&audit=${param.audit }&"/> 
      <%@ include file="/view/user/pagination.jsp"%>
      <br/><br/>
   </div>

<script src="${ctx}/view/user/js/common.js"></script>
<script type="text/javascript">
	function edit() {
		window.location.href='${ctx}/user/comment/edit';
	}
</script>
  <input name="path" value="${path }" type="hidden"/>
  <div class="clear">&nbsp;</div>
   
  <jsp:include page="bottom.jsp"></jsp:include>  
</body>
</html>